home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C & C++ Multimedia Cyber Classroom
/
C and C++ Multimedia Cyber Classroom (Prentice Hall) (1998).iso
/
src
/
fig05_06.jar
/
Ch05
/
Fig05_06
/
Fig05_06.cpp
next >
Wrap
C/C++ Source or Header
|
1997-10-14
|
430b
|
22 lines
// Fig. 5.6: fig05_06.cpp
// Cube a variable using call-by-value
#include <iostream.h>
int cubeByValue( int ); // prototype
int main()
{
int number = 5;
cout << "The original value of number is " << number;
number = cubeByValue( number );
cout << "\nThe new value of number is " << number << endl;
return 0;
}
int cubeByValue( int n )
{
return n * n * n; // cube local variable n
}